package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Slf4j
@Api(tags = "移动端菜品分类")
@RestController
@RequestMapping("/user/category")
public class UserCategoryController {
    @Autowired
    private CategoryService categoryService;

    @ApiOperation("分类查询")
    @GetMapping("/list")
    public Result<List<Category>> list(Integer type){
        log.info("移动端用户查询分类查询type-{}",type);
        List<Category> list  = categoryService.findByType(type);
        return Result.success(list);
    }
}
